<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/include.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/styles/css/default.css">

<script>

Ext.onReady(initPage);
 function initPage(){
        var Tree = Ext.tree;
   		var tree = new Tree.TreePanel({
        el:'treeDiv',
        height:400,
        autoScroll:true,
        animate:true,
        enableDD:true,
        containerScroll: true,
        rootVisible:false, 
        loader: new Tree.TreeLoader({
          			 dataUrl:'<s:url namespace="/user" action="myFavarites!getMyFunctions.action"/>'
        })
      });
   	 var root = new Tree.AsyncTreeNode({
         text: '功能',
         draggable:false,
         id:'-1'
     });
     tree.setRootNode(root);
     tree.render();
     root.expand();
     var tpl = new Ext.XTemplate('<tpl for=".">',
	    	  '<input type="hidden" name="funs[{# - 1}].id"  value="{id}" />',
	    	  '</tpl>');
     Ext.get("saveBt").on('click',function(){
		var cn = tree.getChecked();
		tpl.overwrite('funs',cn);
     }); 
     
}
	
</script>
</head>


<body>
	
	<s:form  action="/user/myFavarites!save.action">
	<div id="funs"></div>
	<div id="treeDiv"></div>
	<div class="tableHeader4">
		<s:submit id="saveBt"  cssClass="btn_Text2" value="保存"></s:submit>
	</div>
	</s:form>
</body>
</html>